import rclpy
from rclpy.node import  Node
from base_interface_demo01.msg import Stu
class ListenerStu(Node):
    def __init__(self):
        super().__init__('listener_stu_node_py')
        self.get_logger().info('订阅创建py')
        self.subscription_= self.create_subscription(Stu,'chatter_stu',self.lister_callback,10)
    def lister_callback(self,stu: Stu):
        self.get_logger().info(f'订阅收到py: name={stu.name},age={stu.age},height={stu.height}')
        pass
def main():
    rclpy.init()
    rclpy.spin(ListenerStu())
    rclpy.shutdown()


if __name__=='__main__':
    main()